package com.hp.attendance.service;

import com.hp.attendance.dao.HistoryDao;
import com.hp.attendance.entity.History;
import com.hp.attendance.entity.PageInfo;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

public class HistoryService {
    private HistoryDao historyDao = new HistoryDao();


//    public List<History> getList() throws SQLException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
//        List<History> list = historyDao.getList();
//        return list;
//    }
//
//
//    public List<History> getLimitList(int pageNo, int pageSize) throws SQLException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
//
//        return historyDao.getLimitList(pageNo,pageSize);
//    }
//
//    /**
//     * 查询总记录数
//     * @return
//     * @throws SQLException
//     */
//    public long getTotal() throws SQLException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
//
//        return historyDao.getTotal();
//    }
//
//    public PageInfo<History> getPage(int pageNo, int pageSize) throws SQLException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
//        PageInfo<History> page = new PageInfo<History>();
//
//        //查询分页的数据
//        List<History> list = historyDao.getLimitList(pageNo, pageSize);
//        page.setRecords(list);
//        //查询总记录条数
//        long total = historyDao.getTotal();
//        page.setTotal(total);
//        //设置当前页码
//        page.setCurrent(pageNo);
//        //设置总页数
//        int pages = (int) Math.ceil(total / (pageSize * 1.0));
//        page.setPages(pages);
//        return page;
//    }
}
